<?php 
namespace app\index\model;
use think\Model;
use think\Session;
use think\Db;
header("Content-type: text/html; charset=utf-8");
class Problemstatistics_model extends Model
{
	//今天
	public function nowadays($params)
    {
        $nowadays = Db::query('select * from problem where date(problem_planned_start_date) = curdate()');
    	return $nowadays;
    }

    //今天开始
    public function starting_from_today()
    {
        $starting_from_today = Db::query("select * from problem WHERE problem_planned_start_date = curdate() ");
    	return $starting_from_today;
    }
    // 今天结束
    public function end_today()
    {
        $end_today = Db::query("select * from problem WHERE problem_planned_end_date = curdate() ");
        return $end_today;
    }

    //明天
    public function tomorrow()
    {
        $tomorrow = Db::query("select * from problem where date(problem_change_the_time) = date_sub(curdate(),interval -1 day)");
        return $tomorrow;
    }
    
    // 本周
    public function this_week($params)
    {
        $this_week = Db::query('select * from problem where YEARWEEK(date_format(problem_planned_start_date,"%Y-%m-%d")) = YEARWEEK(now())');
    	return $this_week;
    }
    
	// 本周结束
    public function end_of_the_week()
    {
       $end_of_the_week = Db::query('select * from problem where problem_planned_end_date between current_date()-7 and sysdate()');
        return $end_of_the_week;
    }
    
    //已经过期
    public function already_expired()
    {
        $already_expired = Db::query("select * from problem where problem_planned_end_date <= date_sub(curdate(),interval 1 day)");
        return $already_expired;
    }
}